package cn.iocoder.yudao.module.ai.config;

import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import cn.iocoder.yudao.module.ai.dal.dataobject.algorithmlibrary.AlgorithmLibraryDO;
import cn.iocoder.yudao.module.ai.dal.dataobject.trainingmodel.TrainingModelDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 说明： 数据权限配置
 */
@Configuration(proxyBeanMethods = false)

public class ModelDataPermissionConfiguration {
    @Bean
    public DeptDataPermissionRuleCustomizer modelDeptDataPermissionRuleCustomizer() {
        return rule -> {
            /**
             * 基于部门的数据权限
             * class: 授权权限控制的类
             * columnName: 与部门进行比对的列
             */
            rule.addDeptColumn(AlgorithmLibraryDO.class,"suplier_id");
            rule.addDeptColumn(TrainingModelDO.class,"suplier_id");
        };
    }
}
